from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from time import sleep

#初始化谷歌的浏览器对象
url=r'https://www.baidu.com'

#方式1：默认参数
# driver=webdriver.Chrome()

#方式2：指定Chrome浏览器对象
chrome_location=r'E:\nmon\light_Chrome\chrome-win\chrome.exe'
options=webdriver.ChromeOptions()
options.binary_location=chrome_location
driver=webdriver.Chrome(options=options)

#指定驱动位置
driver_location=r'E:\Py\python\chromedriver.exe'
service = Service(driver_location)
# driver = webdriver.Chrome(test_cases_webtours=test_cases_webtours, service=service)

#打开网页
driver.get(url)
print(driver.title)
sleep(3)

#关闭浏览器驱动对象
driver.quit()